

#ifndef __MATERIALMANAGER_H__
#define __MATERIALMANAGER_H__

#include <export.h>
#include <iobject.h>
#include <list>
#include <map>
#include <string>


struct iEffect;
struct iFile;
struct iTexture;
class ceMaterial;
class ceMultiLayerEffect;
/**
 * \addtogroup engine
 * @{
 */

/**
 * @brief Manager holding all material related resources
 */
class CE_API ceMaterialManager : public iObject
{
  CE_OBJECT

private:
  static ceMaterialManager* static_instance;

	std::map<std::string, iEffect*>							_effects;
	std::map<std::string, ceMaterial*>					_materials;
	ceMaterial*																	_defaultMaterial;

	std::map<std::string, iTexture*>						_textures;

protected:
  ceMaterialManager();
  ~ceMaterialManager ();

public:

  static ceMaterialManager* Get ();
  static ceMaterialManager* Reset (ceMaterialManager* materialManager = 0);

	void AddEffect (const std::string& name, iEffect* effect);
	iEffect* GetEffect (const std::string& file);
	const iEffect* GetEffect (const std::string& name) const;
  std::list<std::string> GetEffectNames () const;

	void AddMaterial (const std::string& name, ceMaterial* material, bool isDefault = false);
	ceMaterial* GetMaterial (const std::string& name);
  const ceMaterial* GetMaterial (const std::string& name) const;
  std::list<std::string> GetMaterialNames () const;

	void SetDefaultMaterial (ceMaterial* material);
	ceMaterial* GetDefaultMaterial ();
  const ceMaterial* GetDefaultMaterial () const;

  void AddTexture (const std::string& name, iTexture* texture);
  iTexture* GetTexture (const std::string& name);
  const iTexture* GetTexture (const std::string& name)const;
  std::list<std::string> GetTextureNames () const;

};

/** @} */


#endif // MATERIALMANAGER_H
